<%@ include file="init.jsp" %>

<portlet:renderURL var='urlAdd'><portlet:param name='action' value='addGrupyTowarow'/></portlet:renderURL>
<portlet:renderURL var='urlEdit'><portlet:param name='action' value='editGrupyTowarow'/><portlet:param name='gtId' value='${gtId}'/></portlet:renderURL>
<portlet:renderURL var='urlDelete'><portlet:param name='action' value='deleteGrupyTowarow'/><portlet:param name='gtId' value='${gtId}'/></portlet:renderURL>
<portlet:renderURL var='urlView'><portlet:param name='action' value='view'/></portlet:renderURL>

<p>
	<aui:button name='addGt' value='add-gt' onclick='<%=renderResponse.getNamespace()+"toAddGt()" %>' />
	<aui:button name='view' value='view' onclick='<%=renderResponse.getNamespace()+"toViev()" %>' />
</p>

<aui:script>
	function <%=renderResponse.getNamespace() %>toAddGt() {
		window.location.href='<%=urlAdd%>';
		}
	function <%=renderResponse.getNamespace() %>toViev() {
		window.location.href='<%=urlView%>';
		}
</aui:script>

<table style='width: 100%;'>
	<tr class="portlet-section-header results-header">
		<td>
			<b>
				<a style='text-decoration: none;' href='<portlet:renderURL>
						<portlet:param name='action' value='viewGrupyTowarow'/>
						<portlet:param name='order' value='id'/>
						</portlet:renderURL>'>

					<liferay-ui:message key="id" />

					<c:if test="${order=='id'}">
						&or;
					</c:if>
				</a>
			</b>
		</td>
		<td>
			<b>
				<a style='text-decoration: none;' href='<portlet:renderURL>
						<portlet:param name='action' value='viewGrupyTowarow'/>
						<portlet:param name='order' value='opis'/>
						</portlet:renderURL>'>

					<liferay-ui:message key="opis" />

					<c:if test="${order=='opis'}">
						&or;
					</c:if>
				</a>
			</b>
		</td>
		<td>
			<b>
				<a style='text-decoration: none;' href='<portlet:renderURL>
						<portlet:param name='action' value='viewGrupyTowarow'/>
						<portlet:param name='order' value='userId'/>
						</portlet:renderURL>'>

					<liferay-ui:message key="userId" />

					<c:if test="${order=='userId'}">
						&or;
					</c:if>
				</a>
			</b>
		</td>
		<td>
			<b>
				<a style='text-decoration: none;' href='<portlet:renderURL>
						<portlet:param name='action' value='viewGrupyTowarow'/>
						<portlet:param name='order' value='kolejnosc'/>
						</portlet:renderURL>'>

					<liferay-ui:message key="kolejnosc" />

					<c:if test="${order=='kolejnosc'}">
						&or;
					</c:if>
				</a>
			</b>
		</td>
	</tr>

	<c:forEach var="item" items="${lgt}">
		<portlet:renderURL var='urlViewGt'>
			<portlet:param name='gtid' value='${item.id}'/>
		</portlet:renderURL>

		<tr>
			<td>
				<span style='color: #7B7C7F'>${item.id}</span>
			</td>
			<td>		
				<aui:a href='${urlViewGt}'>
					${item.opis}
				</aui:a>
			</td>
			<td>
				<span style='color: #7B7C7F'>${item.userId}</span>
			</td>
			<td>
				<span style='color: #7B7C7F'>${item.kolejnosc}</span>
			</td>
		</tr>
	</c:forEach>
</table>